<me:UIGLLG x:Class="WPFExcelReport.TGLLG"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"     
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    x:Name="TV"
                    Loaded="Window_Loaded" >
    <me:UIGLLG.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/> 
        <ucd:Divideby1000  x:Key="d1000"/> 
        <ucd:PNumConverter  x:Key="pnum"/> 
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIGLLG.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel>
            <WrapPanel>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=库区:}}"></TextBlock>
                    <ex:TXT72 Grid.Column="1" 
                          Text="{Binding EXCLUDEWH,ElementName=TV}" 
                          Width="100" />
                </Grid>
                <TextBlock Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=需求}}"  VerticalAlignment="Center" />
                <TextBlock Background="White"  Text="{Binding Path=KG1, Converter={StaticResource ResourceKey=d100}}"  Height="Auto"    
                       Width="Auto"     Margin="5,0,0,0"   VerticalAlignment="Center"/>
                <TextBlock Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=留位}}" 
                       VerticalAlignment="Center" />
                <TextBlock Background="White"  Text="{Binding Path=KG3, Converter={StaticResource ResourceKey=d100}}"  Height="Auto" 
                       Width="Auto"     Margin="5,0,0,0"   VerticalAlignment="Center"/>
                <TextBlock Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=+(}}" 
                       VerticalAlignment="Center" />
                <TextBlock Grid.Column="1" Background="White"  Text="{Binding Path=KG5, Converter={StaticResource ResourceKey=d100}}"  
                       Height="Auto"    Width="Auto"     Margin="5,0,0,0"   VerticalAlignment="Center"/>
                <TextBlock Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=)}}"  
                       VerticalAlignment="Center" /> 
            </WrapPanel>
            <WrapPanel> 
                <TextBlock Height="Auto"   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=未留位}}"
                       VerticalAlignment="Center" />
                <TextBlock Grid.Column="1" Background="White" Text="{Binding Path=REQ, Converter={StaticResource ResourceKey=d100}}"   
                       Foreground="Red"
                       Height="Auto"    Width="60"     Margin="5,0,0,0"   VerticalAlignment="Center"/>
                <WrapPanel Visibility="{Binding ALLCOATE,Converter={StaticResource bv}}">
                    <Button Margin="10,0,0,0"   Click="btnAllocate_Click" Content="{Binding Source={Localization:Translate Word=留位}}"/>
                    <Button Margin="10,0,0,0"   Click="btnPartialAllocate_Click" Content="{Binding Source={Localization:Translate Word=部分}}"/>
                    <ex:NumericBox Text="{Binding QTY,ElementName=TV}" DecimalPlaces="2" Width="40" 
                               Margin="10,0,0,0" />
                </WrapPanel>

                <Grid Visibility="{Binding FTREQ,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0" FontSize="18" Width="30" Height="30" Margin="0,0,0,0" Name="btnRemoveBook"   Click="btnRemoveAllocate_Click">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Delete.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Source={Localization:TranslateExtension Word=取消}}"></TextBlock>
                </Grid>
            </WrapPanel>
        </StackPanel>
     
        <DataGrid  Grid.Row="1" Grid.Column="0"  
                                           FontSize="12" 
                                           CanUserReorderColumns="True"  
                                           CanUserResizeRows="True" CanUserSortColumns="True"                  
                                           AutoGenerateColumns="False"   
                                           EnableRowVirtualization="True"  
                                           RowDetailsVisibilityMode="VisibleWhenSelected"   VerticalAlignment="Top"
                                           IsSynchronizedWithCurrentItem="True" VerticalScrollBarVisibility="Auto" Visibility="Visible"
                                           Name="dlgMaster"
                                           ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"   >
            <DataGrid.Columns>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=ID}}" Binding="{Binding GLLBEHI,Converter={StaticResource ResourceKey=pnum}}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=P}}" Binding="{Binding LPLBKZ}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=LO}}" Binding="{Binding Path=GLLO}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=LB}}" Binding="{Binding Path=GLLB}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=LP}}" Binding="{Binding Path=GLLP}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=库存}}" Binding="{Binding Path=KG}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=留位}}" Binding="{Binding Path=ALLOKG}" Width="Auto"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=自由}}" Binding="{Binding Path=FREEKG}" Width="Auto"/>
            </DataGrid.Columns>
        </DataGrid  > 
    </Grid>
</me:UIGLLG>
